

class Vec2 {
    constructor(x = 0,y = 0){
        this.x = x;
        this.y = y;
    }
}

function rotateLeft(pos){
    return new Vec2(pos.y,-pos.x);
}

function rotateRight(pos){
    return new Vec2(-pos.y,pos.x);
}



let $ = function(selector){
    return document.querySelector(selector);
};


let Bacon = window.Bacon;
window.onload = function () {
    let test = Bacon.fromEvent($('#btn_test'),'click');
    let counter = test.map(1)
        .scan(0,(x,y)=> x + y);

    counter.onValue(x=>{
        console.log(`x:${x}`);
    });
};
